package com.yixing.tech.common.hikservice.rcs;

import com.yixing.tech.common.base.BusinessException;
import org.bson.types.ObjectId;

import java.util.HashMap;
import java.util.Map;

public class RCSUtilTest {

    // ctu 单任务
    public static void main(String[] args) throws BusinessException {
            RCSConfig.setConfig("10.132.162.110", 8181);
            RCSTaskRequest.RCSTaskRequestBuilder builder = new RCSTaskRequest.RCSTaskRequestBuilder();
            builder.reqCode(new ObjectId().toString());
            builder.taskTyp("MS01");

            Object[] paths = new Object[2];
            Map<String, String> map = new HashMap<>();
            map.put("positionCode", "100002L1202013");
            map.put("type", "05");
            paths[0] = map;

            Map<String, String> map1 = new HashMap<>();
            map1.put("positionCode", "100006L1202013");
            map1.put("type", "05");
            paths[1] = map1;

            builder.positionCodePath(paths);
            builder.ctnrTyp("1");

            RCSTaskRequest request = builder.build();
            RCSUtil.genAgvTask(request);
    }

    // 取消任务
    public static void main2(String[] args) throws BusinessException {
        RCSConfig.setConfig("10.132.162.110", 8181);
        RCSTaskRequest.RCSTaskRequestBuilder builder = new RCSTaskRequest.RCSTaskRequestBuilder();
        builder.reqCode(new ObjectId().toString().substring(0, 10));
        builder.forceCancel("0");
        builder.taskCode("1294baee1f394439ae099443881705be");
        RCSTaskRequest request = builder.build();
        RCSUtil.cancelAgvTask(request);
    }

    // 潜伏 点到点
    public static void qianfu1(String[] args) throws BusinessException {
        RCSConfig.setConfig("10.132.162.110", 8181);
        RCSTaskRequest.RCSTaskRequestBuilder builder = new RCSTaskRequest.RCSTaskRequestBuilder();
        builder.reqCode(new ObjectId().toString());
        builder.taskTyp("MS001");

        Object[] paths = new Object[2];
        Map<String, String> map = new HashMap<>();
        map.put("positionCode", "B1");
        map.put("type", "00");
        paths[0] = map;

        Map<String, String> map1 = new HashMap<>();
        map1.put("positionCode", "A1");
        map1.put("type", "00");
        paths[1] = map1;

        builder.positionCodePath(paths);

        RCSTaskRequest request = builder.build();
        RCSUtil.genAgvTask(request);
    }


}
